
const path = require('path')
class HomeCtrol {
  index(ctx) {
    ctx.body = '<h1>这是主页</h1>';
  }
  async upload(ctx) {
    console.log(ctx.request, 'ctx.request')
    console.log(ctx.request.files, 'ctx.request.files')
    const file = ctx.request.files.file;
    const basename = path.basename(file.path);
    ctx.body = { url: `${ctx.origin}/uploads/${basename}` };
  }
}

module.exports = new HomeCtrol()